﻿<UserControl x:Class="OrbitOne.CRMLyncInfoDashboard.Shell.DetailView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" mc:Ignorable="d"
    xmlns:cal="http://www.caliburnproject.org"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:windowsToolbar="clr-namespace:Windows.Toolbar.Controls;assembly=Windows.Toolbar"
             d:DesignHeight="800" d:DesignWidth="400" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Common.xaml" />
                <ResourceDictionary Source="Resources/DetailViewResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    </UserControl.Resources>

    <toolkit:DockPanel>
        <toolkit:ContextMenuService.ContextMenu>
            <toolkit:ContextMenu>
                <toolkit:MenuItem Header="Refresh" cal:Message.Attach="[Event Click] = [Action RefreshContents()]" />
                <toolkit:MenuItem Header="Back" cal:Message.Attach="[Event Click] = [Action ShowSummaryView()]" />
            </toolkit:ContextMenu>
        </toolkit:ContextMenuService.ContextMenu>

        <Border Style="{StaticResource MenuBorderStyle}"  
                toolkit:DockPanel.Dock="Top">
            <Border.Effect>
                <DropShadowEffect Color="Gray" BlurRadius="5" Direction="275"/>
            </Border.Effect>
            <StackPanel Orientation="Horizontal" Height="71">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <windowsToolbar:ToolbarButton
                                         Style="{StaticResource ToolbarButtonStyle}"
                                          Grid.Column="0"
                                          cal:Message.Attach="ShowSummaryView()">
                        <StackPanel>
                            <Image Source="../Images/Backward.png" Style="{StaticResource MenuImageStyle}"/>
                            <!--<TextBlock Foreground="Black" Text="Back"
                               HorizontalAlignment="Center"/>-->
                        </StackPanel>
                    </windowsToolbar:ToolbarButton>

                    <Rectangle Grid.Column="1" Width="1"  Fill="#e7e7e8"  Height="58" VerticalAlignment="Bottom" />
                    <windowsToolbar:ToolbarButton 
                                          Style="{StaticResource ToolbarButtonStyle}"                                                                                     
                                          Grid.Column="2"
                                          cal:Message.Attach="LogPhoneCallActivity()">
                        <StackPanel>
                            <Image Source="../Images/ico_fhe_4210.png" Style="{StaticResource MenuImageStyle}"/>

                            <StackPanel Orientation="Vertical">
                                <TextBlock Style="{StaticResource MenuTextStyleTopLine}" Text="Log" />
                                <TextBlock Style="{StaticResource MenuTextStyleBottomLine}" Text="Phone Call"/>
                            </StackPanel>
                        </StackPanel>
                    </windowsToolbar:ToolbarButton>

                    <windowsToolbar:ToolbarButton 
                                          Style="{StaticResource ToolbarButtonStyle}"
                                          Grid.Column="3"
                                          cal:Message.Attach="AddNote()">
                        <StackPanel>
                            <Image Source="../Images/NoteYellowAdd32.png" Style="{StaticResource MenuImageStyle}"/>

                            <StackPanel Orientation="Vertical">
                                <TextBlock Style="{StaticResource MenuTextStyleTopLine}" Text="Add"/>
                                <TextBlock Style="{StaticResource MenuTextStyleBottomLine}" Text="Note"/>
                            </StackPanel>
                        </StackPanel>
                    </windowsToolbar:ToolbarButton>
                    
                    <windowsToolbar:ToolbarButton 
                                          Style="{StaticResource ToolbarButtonStyle}"
                                          Grid.Column="4"
                                          cal:Message.Attach="AddTask()">
                        <StackPanel>
                            <Image Source="../Images/Entity32_4212.png" Style="{StaticResource MenuImageStyle}"/>

                            <StackPanel Orientation="Vertical">
                                <TextBlock Style="{StaticResource MenuTextStyleTopLine}" Text="Add"/>
                                <TextBlock Style="{StaticResource MenuTextStyleBottomLine}" Text="Task"/>
                            </StackPanel>
                        </StackPanel>
                    </windowsToolbar:ToolbarButton>

                    <windowsToolbar:ToolbarButton 
                                          Style="{StaticResource ToolbarButtonStyle}"
                                          Grid.Column="5"
                                          cal:Message.Attach="EditEntity()">
                        <StackPanel>
                            <Image Source="../Images/Edit32.png" Style="{StaticResource MenuImageStyle}"/>

                            <StackPanel Orientation="Vertical">
                                <TextBlock Style="{StaticResource MenuTextStyleTopLine}" Text="Edit"/>
                                <TextBlock Style="{StaticResource MenuTextStyleBottomLine}" Text="in CRM"/>
                            </StackPanel>
                        </StackPanel>
                    </windowsToolbar:ToolbarButton>


                </Grid>

            </StackPanel>
        </Border>

        <Border Style="{StaticResource OuterBorderStyle}">
            <Border Style="{StaticResource ContentBorderStyle}">
                <toolkit:DockPanel Style="{StaticResource DockPanelStyle}">
                    
                <StackPanel Style="{StaticResource StackPanelStyle}" toolkit:DockPanel.Dock="Top">                    
                    <StackPanel Orientation="Horizontal"  Style="{StaticResource StackPanelStyleGradient}">
                        <Image Source="{Binding ImageLocation}" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                        <StackPanel Orientation="Vertical">
                            <TextBlock x:Name="EntityTypeName" Style="{StaticResource EntityTypeNameStyle}"/>
                            <TextBlock x:Name="DisplayText" Style="{StaticResource DisplayTextStyle}" />
                        </StackPanel>
                    </StackPanel>

                    <ListBox x:Name="DisplayFields"
                     Style="{StaticResource ListBoxStyle}"
                     ItemContainerStyle="{StaticResource ListBoxItemStyleTransparentSelect}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="{Binding LabelText}" 
                                               Style="{StaticResource FieldLabelStyle}"
                                               />
                                    <TextBlock Text="{Binding FieldValue}" 
                                               Style="{StaticResource FieldValueStyle}"
                                               Cursor="{Binding Cursor}" 
                                               cal:Message.Attach="[Event MouseLeftButtonUp] = [Action OnFieldClick($dataContext)]"/>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>


                </StackPanel>

                <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" 
                                    toolkit:DockPanel.Dock="Bottom" 
                                    Style="{StaticResource StackPanelStyle}" 
                                    HorizontalAlignment="Center">
                    <Border Style="{StaticResource LogoBorderStyle}">
                        <Image Source="../Images/logo_only_orbit_240_black_gif.png" Height="60"/>
                    </Border>
                </StackPanel>
                </toolkit:DockPanel>
            </Border>
        </Border>
    </toolkit:DockPanel>

</UserControl>
